home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Form / Sources / Dialog.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  20.3 KB  |  616 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Dialog.cpp
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "Form.hpp"
  11.  
  12. #ifndef DIALOG_H
  13. #include "Dialog.h"
  14. #endif
  15.  
  16. #ifndef PART_H
  17. #include "Part.h"
  18. #endif
  19.  
  20. #ifndef FRAME_H
  21. #include "Frame.h"
  22. #endif
  23.  
  24. #ifndef VIEW_H
  25. #include "View.h"
  26. #endif
  27.  
  28. #ifndef DEFINES_K
  29. #include "Defines.k"
  30. #endif
  31.  
  32. // ----- Framework Layer -----
  33.  
  34. #ifndef FWEDVIEW_H
  35. #include "FWEdView.h"
  36. #endif
  37.  
  38. #ifndef FWSTATIC_H
  39. #include "FWStatic.h"
  40. #endif
  41.  
  42. #ifndef FWUTIL_H
  43. #include "FWUtil.h"
  44. #endif
  45.  
  46. #ifndef FWCONTXT_H
  47. #include "FWContxt.h"
  48. #endif
  49.  
  50. #ifndef FWBUTTON_H
  51. #include "FWButton.h"
  52. #endif
  53.  
  54. #ifndef FWKEYF_H
  55. #include "FWKeyF.h"
  56. #endif
  57.  
  58. #ifndef FWNOTDEF_H
  59. #include "FWNotDef.h"
  60. #endif
  61.  
  62. // ----- OS Layer -----
  63.  
  64. #ifndef FWMENU_H
  65. #include "FWMenu.h"
  66. #endif
  67.  
  68. #ifndef FWEVENT_H
  69. #include "FWEvent.h"
  70. #endif
  71.  
  72. #ifndef FWALERT_H
  73. #include "FWAlert.h"
  74. #endif
  75.  
  76. #ifndef SLMixOS_H
  77. #include "SLMixOS.h"
  78. #endif
  79.  
  80. #ifndef FWCFMRES_H
  81. #include "FWCFMRes.h"
  82. #endif
  83.  
  84. // ----- Graphic Includes -----
  85.  
  86. #ifndef FWRECT_H
  87. #include "FWRect.h"
  88. #endif
  89.  
  90. #ifndef FWTXTBOX_H
  91. #include "FWTxtBox.h"
  92. #endif
  93.  
  94. #ifndef FWRECSHP_H
  95. #include "FWRecShp.h"
  96. #endif
  97.  
  98. // ----- Foundation Layer -----
  99.  
  100. #ifndef FWEXCDEF_H
  101. #include "FWExcDef.h"
  102. #endif
  103.  
  104. #ifndef FWNOTIFN_H
  105. #include "FWNotifn.h"
  106. #endif
  107.  
  108. #ifndef FWMEMMGR_H
  109. #include "FWMemMgr.h"
  110. #endif
  111.  
  112. // ----- PPob View Support -----
  113.  
  114. #if FW_PPOB_VIEWS
  115. #include "FWPPobRd.h"
  116. #endif
  117.  
  118. // ----- MacApp View Support -----
  119.  
  120. #if FW_MACAPP_VIEWS
  121. #include "FWMARead.h"
  122. #endif
  123.  
  124. // Check that Form is using only 1 view system!
  125. #if (FW_ODFRC_VIEWS && FW_MACAPP_VIEWS) || (FW_ODFRC_VIEWS && FW_PPOB_VIEWS) || (FW_MACAPP_VIEWS && FW_PPOB_VIEWS)
  126. #include "Error in Defines.k: define only 1 flag FW_XXXX_VIEWS at a time!"
  127. #endif
  128.  
  129. //========================================================================================
  130. // Runtime Informations
  131. //========================================================================================
  132.  
  133. #ifdef FW_BUILD_MAC
  134. #pragma segment odfform
  135. #endif
  136.  
  137. FW_DEFINE_AUTO(CPwdDialogFrame)
  138. FW_DEFINE_AUTO(CPwdEditView)
  139.  
  140. //========================================================================================
  141. // class CPwdDialogFrame 
  142. //========================================================================================
  143.  
  144. //----------------------------------------------------------------------------------------
  145. // CPwdDialogFrame::CPwdDialogFrame
  146. //----------------------------------------------------------------------------------------
  147. CPwdDialogFrame::CPwdDialogFrame(Environment* ev, ODFrame* odFrame, 
  148.                         FW_CPresentation* presentation,    CFormPart* part)
  149.     : FW_CDialogFrame(ev, odFrame, presentation, part) 
  150. {
  151.  
  152.     // If your modal dialog contains edit views which support Undo/Redo like CScrollEditView
  153.     // you should uncomment the following line to mark the Undo & Redo stacks
  154.     // This way you can clear the action history when the dialog is deleted (see below).    
  155. //    part->GetSession(ev)->GetUndo(ev)->MarkActionHistory(ev);
  156. }
  157.  
  158. //----------------------------------------------------------------------------------------
  159. // CPwdDialogFrame::~CPwdDialogFrame
  160. //----------------------------------------------------------------------------------------
  161.  
  162. CPwdDialogFrame::~CPwdDialogFrame()
  163. {
  164.     // If your modal dialog contains edit views which support Undo/Redo like CScrollEditView
  165.     // you should uncomment the following line to clear the Undo & Redo stacks
  166. //    GetPart(ev)->GetSession(ev)->GetUndo(ev)->ClearActionHistory(ev, kODRespectMarks);
  167. }
  168.  
  169. //----------------------------------------------------------------------------------------
  170. // CPwdDialogFrame::FacetAdded
  171. //----------------------------------------------------------------------------------------
  172. // On the Mac we need to add a color table to the dialog window in order to draw
  173. // a uniform gray background (otherwise the dialog frame keeps a white border)
  174.  
  175. #ifdef FW_BUILD_MAC
  176.  
  177. void CPwdDialogFrame::FacetAdded(Environment* ev, ODFacet* facet, unsigned short facetCount)
  178. {
  179.     FW_CDialogFrame::FacetAdded(ev, facet, facetCount);
  180.     
  181.     if (facetCount == 1)
  182.     {
  183.         ODPlatformWindow platformWindow = facet->GetWindow(ev)->GetPlatformWindow(ev);
  184.         
  185.         WCTabHandle newColorTable = (WCTabHandle)FW_CMemoryManager::AllocateSystemHandle
  186.                                                                     (8+sizeof(ColorSpec));
  187.         (*newColorTable)->ctSize = 0;
  188.         (*newColorTable)->ctTable[0].value = wContentColor;
  189.         (*newColorTable)->ctTable[0].rgb = FW_CColor(FW_kRGBLightGray);
  190.         ::SetWinColor(platformWindow, newColorTable);
  191.     }
  192. }
  193. #else
  194. //----------------------------------------------------------------------------------------
  195. // CPwdDialogFrame::Draw
  196. //----------------------------------------------------------------------------------------
  197.  
  198. void CPwdDialogFrame::Draw(Environment *ev, ODFacet* odFacet, ODShape* invalidShape)
  199. {
  200.     // Set drawing contect for the CFrame
  201.     FW_CViewContext vc(ev, this, odFacet, invalidShape);
  202.  
  203.     // Draw gray background
  204.     FW_CRectShape::RenderRect(vc, GetBounds(ev), FW_kFill, FW_kRGBLightGray);
  205.  
  206. }
  207. #endif // FW_BUILD_MAC
  208.  
  209. //----------------------------------------------------------------------------------------
  210. //    CPwdDialogFrame::PostCreateViewFromStream
  211. //----------------------------------------------------------------------------------------
  212. // PostCreateViewFromStream is called after subviews are created from resources.  
  213. // Implement initializations for this view that can't be done from a stream.
  214.  
  215. void CPwdDialogFrame::PostCreateViewFromStream(Environment* ev)
  216. {
  217.     // ----- Call inherited to propagate to all subviews if necessary
  218.     FW_CSuperView::PostCreateViewFromStream(ev);
  219.  
  220.     // ----- Add alpha-numeric keyfilters to edit views 
  221.     //        (will be deleted along with the edit views, they are adopted event handlers)
  222.     FW_CView* editView1 = FindViewByID(ev, kPasswordEditID);    
  223.     FW_CView* editView2 = FindViewByID(ev, kConfirmEditID);    
  224.     FW_ASSERT(editView1 && editView2);
  225.     
  226.     FW_CAlphaNumFilter* keyF1 = new FW_CAlphaNumFilter(ev, (FW_MEventHandler*)editView1);
  227.     FW_CAlphaNumFilter* keyF2 = new FW_CAlphaNumFilter(ev, (FW_MEventHandler*)editView2);
  228.     
  229.     // Note: OK and Cancel buttons are linked automatically to the dialogFrame by
  230.     //         defining FW_kDefaultButtonMsg and FW_kCancelButtonMsg in "Views.fr"
  231.  
  232.     // WARNING: Make sure that classes created from resources won't be dead-stripped
  233.     //            (here we don't need to worry about our custom class CPwdEditView
  234.     //            because all its implementation is compiled in this file)
  235.     FW_DO_NOT_DEAD_STRIP(FW_CButton);
  236.     FW_DO_NOT_DEAD_STRIP(FW_CStaticText);
  237. }
  238.  
  239. //----------------------------------------------------------------------------------------
  240. // CPwdDialogFrame::CreateSubViews
  241. //----------------------------------------------------------------------------------------
  242.  
  243. #if !FW_ODFRC_VIEWS
  244. void CPwdDialogFrame::CreateSubViews(Environment* ev)
  245. {        
  246. #if FW_PPOB_VIEWS
  247.     // Load views from PPob resources.  Pass "true" to connect the frame to all controls 
  248.     FW_PlatformError error = FW_CPPobReader::CreateSubViewsFromPPobResource(ev, 
  249.                                                     kPasswordDialog, 
  250.                                                     this,  // root view
  251.                                                     this,  // controls' receiver
  252.                                                     FW_CPPobReader::kPartOnly);
  253.  
  254. #elif FW_MACAPP_VIEWS
  255.     // Load views from MacApp resource id kFormView.  Same as PPOB views above.
  256.     FW_PlatformError error = FW_CMacAppReader::CreateSubViewsFromMacAppResource(ev, 
  257.                                                     kPasswordDialog, 
  258.                                                     this,  // root view
  259.                                                     this,  // controls' receiver
  260.                                                     FW_CMacAppReader::kPartOnly);
  261.  
  262. #endif
  263.  
  264. #if 0
  265.     // NOTE: CreateSubViews is not needed when the frame's ctor is passed a resource id.
  266.     //          This code was left here to show how to create views by program
  267.     FW_CRect viewRect;        // working rectangle for creating the views
  268.     
  269.     // ---- Create the static texts
  270.     viewRect.Set(FW_IntToFixed(20), FW_IntToFixed(40), FW_IntToFixed(140), FW_IntToFixed(70));
  271.     FW_CStaticText* staticText1 = FW_NEW(FW_CStaticText, (ev, this, viewRect, FW_CString("Pick a \rpassword:")));
  272.  
  273.     viewRect.Set(FW_IntToFixed(20), FW_IntToFixed(70), FW_IntToFixed(140), FW_IntToFixed(100));
  274.     FW_CStaticText* staticText2 = FW_NEW(FW_CStaticText, (ev, this, viewRect, FW_CString("Retype to \nverify:")));
  275.     
  276.     // ---- Create the text edit controls using our custom Edit Views
  277.     viewRect.Set(FW_IntToFixed(150), FW_IntToFixed(40), FW_IntToFixed(280), FW_IntToFixed(60));
  278.     CPwdEditView* editView1 = FW_NEW(CPwdEditView, (ev, this, kPasswordEditID, viewRect));
  279.  
  280.     viewRect.Set(FW_IntToFixed(150), FW_IntToFixed(70), FW_IntToFixed(280), FW_IntToFixed(90));
  281.     CPwdEditView* editView2 = FW_NEW(CPwdEditView, (ev, this, kConfirmEditID, viewRect));
  282.     
  283.     // ----- Add alpha-numeric keyfilters to edit views
  284.     FW_CAlphaNumFilter* keyF1 = new FW_CAlphaNumFilter(ev, (FW_MEventHandler*)editView1);
  285.     FW_CAlphaNumFilter* keyF2 = new FW_CAlphaNumFilter(ev, (FW_MEventHandler*)editView2);
  286.     
  287.     // ----- Create the OK/Cancel buttons: 
  288.     //        - Use normal font instead of default system font
  289.     //        - Set the control message so that they are initialized as "default" and "cancel" 
  290.     //          dialog buttons  (no need to call SetDefaultButton() and SetCancelButton() later)
  291.     viewRect.Set(FW_IntToFixed(180), FW_IntToFixed(117), FW_IntToFixed(260), FW_IntToFixed(148));
  292.     FW_CButton* okButton = FW_NEW(FW_CButton, (ev, this, kOKButtonID, viewRect, FW_kPushButton, 
  293.                                         FW_CString("OK"), FW_kNormalFont, FW_kDefaultButtonMsg));
  294.  
  295.     viewRect.Set(FW_IntToFixed(60), FW_IntToFixed(123), FW_IntToFixed(140), FW_IntToFixed(145));
  296.     FW_CButton* cancelButton = FW_NEW(FW_CButton, (ev, this, kCancelButtonID, viewRect, FW_kPushButton, 
  297.                                         FW_CString("Cancel"), FW_kNormalFont, FW_kCancelButtonMsg));
  298. #endif
  299. }
  300. #endif
  301.  
  302. //----------------------------------------------------------------------------------------
  303. // CPwdDialogFrame::Initialize
  304. //----------------------------------------------------------------------------------------
  305. // You can group all additional dialog initialization in a local method like this one
  306. // or simply put the code after your call to FW_CDialogFrame::NewModalDialog 
  307.  
  308. void CPwdDialogFrame::Initialize(Environment* ev, CFormFrame* frame)
  309. {
  310. FW_UNUSED(ev);
  311.     fFormFrame = frame;
  312. }
  313.  
  314. //----------------------------------------------------------------------------------------
  315. //    CPwdDialogFrame::HandleNotification
  316. //----------------------------------------------------------------------------------------
  317.  
  318. void CPwdDialogFrame::HandleNotification(Environment* ev, const FW_CNotification& notification)
  319. {
  320.     // ---- Verify edit fields when clicking on OK button ----
  321.     if (notification.GetMessage() ==  FW_kDefaultButtonMsg) 
  322.     {
  323.         // Get the 2 edit views
  324.         FW_CView* view =  FindViewByID(ev, kPasswordEditID);
  325.         CPwdEditView* pwdTEd = FW_DYNAMIC_CAST(CPwdEditView, view);
  326.         FW_ASSERT(pwdTEd);
  327.         view =  FindViewByID(ev, kConfirmEditID);
  328.         CPwdEditView* confirmTEd = FW_DYNAMIC_CAST(CPwdEditView, view);
  329.         FW_ASSERT(confirmTEd);
  330.  
  331.         // Check that the password has at least 3 characters
  332.         FW_CString text = pwdTEd->GetText(ev);
  333.         
  334.         if (text.GetCharacterLength() < 3) {
  335.             // Open Alert and return to avoid closing the dialog
  336.             FW_ErrorAlert(FW_CString(), FW_CString("Password must contain at least 3 characters"));
  337.             return;
  338.         }
  339.         
  340.         // Check that both strings are equal
  341.         FW_CString text2 = confirmTEd->GetText(ev);
  342.         
  343.         if (text != text2) {
  344.             // Open Alert and return to avoid closing the dialog
  345.             FW_ErrorAlert(FW_CString(), FW_CString("Please re-type, strings don't match"));
  346.             return;
  347.         }
  348.         
  349.         // Password is OK, we can switch the form. 
  350.         CFormView* formView = (CFormView*) fFormFrame->GetContentView(ev);
  351.         formView->SwitchForm(ev);
  352.     } 
  353.     
  354.     // Must call inherited to close the dialog on OK & Cancel
  355.     // WARNING: do not do anything else after this call... the dialog is gone!
  356.     FW_CDialogFrame::HandleNotification(ev, notification);
  357. }
  358.  
  359. //========================================================================================
  360. // class CPwdEditView 
  361. //========================================================================================
  362.  
  363. FW_DEFINE_CLASS_M1(CPwdEditView, FW_CEditView);
  364.  
  365. const FW_ClassTypeConstant LPwdEditView = FW_TYPE_CONSTANT('P','w','d','v');
  366. FW_REGISTER_ARCHIVABLE_CLASS(LPwdEditView, CPwdEditView, CPwdEditView::Create, FW_CView::Read, CPwdEditView::Destroy, FW_CView::Write)
  367.  
  368. //----------------------------------------------------------------------------------------
  369. // CPwdEditView::CPwdEditView
  370. //----------------------------------------------------------------------------------------
  371. CPwdEditView::CPwdEditView(Environment* ev, 
  372.                         FW_CSuperView* container, 
  373.                         const FW_CRect& bounds,
  374.                         ODID viewID)
  375.     : FW_CEditView(ev, container, bounds, viewID) 
  376. {
  377.     Initialize(ev, container, bounds);
  378. }
  379.  
  380. //----------------------------------------------------------------------------------------
  381. // CPwdEditView::CPwdEditView
  382. //----------------------------------------------------------------------------------------
  383. CPwdEditView::CPwdEditView(Environment* ev)
  384.     : FW_CEditView(ev) 
  385. {
  386. }
  387.  
  388. //----------------------------------------------------------------------------------------
  389. // CPwdEditView::~CPwdEditView
  390. //----------------------------------------------------------------------------------------
  391.  
  392. CPwdEditView::~CPwdEditView()
  393. {
  394. }
  395.  
  396. //----------------------------------------------------------------------------------------
  397. // CPwdEditView::Initialize
  398. //----------------------------------------------------------------------------------------
  399.  
  400. void CPwdEditView::Initialize(Environment* ev, FW_CSuperView* container, const FW_CRect& bounds)
  401. {
  402.     FW_CRect farBounds(bounds);
  403.     farBounds.Place(FW_IntToFixed(30000), FW_IntToFixed(30000));
  404.  
  405.     // Create a shadow edit view to hold the real text
  406.     // (Note: Making the view invisible is not enough to hide it because the Mac toolbox
  407.     //  will still draw the text being inserted with TEKey) 
  408.     fShadowTEd = FW_NEW(FW_CEditView, (ev, container, farBounds, FW_kNoViewID));
  409.     fShadowTEd->Disable(ev);
  410. }
  411.  
  412. //----------------------------------------------------------------------------------------
  413. // CPwdEditView::ActivateTarget
  414. //----------------------------------------------------------------------------------------
  415.  
  416. void CPwdEditView::ActivateTarget (Environment * ev, FW_Boolean tabSelection)
  417. {
  418.     // must select also the shadow TEd after a Tab
  419.     if (tabSelection)
  420.         fShadowTEd->SelectAll(ev);
  421.     
  422.     FW_CEditView::ActivateTarget(ev, tabSelection);
  423. }    
  424.  
  425. //----------------------------------------------------------------------------------------
  426. // CPwdEditView::DoMenu
  427. //----------------------------------------------------------------------------------------
  428.  
  429. FW_Handled CPwdEditView::DoMenu (Environment* ev, const FW_CMenuEvent& event)
  430. {
  431.     switch (event.GetCommandID(ev)) {
  432.         case kODCommandCut: 
  433.         case kODCommandCopy: 
  434.         case kODCommandPaste: 
  435.         case kODCommandClear: 
  436.             return FW_kHandled;
  437.         case kODCommandSelectAll: 
  438.             SelectAll(ev);
  439.             break;
  440.         default:
  441.             return FW_CView::DoMenu (ev, event);
  442.     }
  443.     return FW_kHandled;
  444. }
  445.  
  446. //----------------------------------------------------------------------------------------
  447. // CPwdEditView::DoCharKey
  448. //----------------------------------------------------------------------------------------
  449.  
  450. FW_Handled CPwdEditView::DoCharKey (Environment* ev, const FW_CCharKeyEvent & event)
  451. {
  452. #ifdef FW_BUILD_MAC
  453.     char bullet = 0xA5;
  454.  
  455.     if (event.IsItemModifier(ev))
  456.         return FW_kNotHandled;
  457. #endif
  458. #ifdef FW_BUILD_WIN
  459.     char bullet = '*';
  460. #endif
  461.  
  462.     // For printable chars use bullet in visible TEd instead of real char
  463.     char realChar = event.GetChar(ev);
  464.     char pwdChar = (realChar >= 0x20) ? bullet : realChar;
  465.     
  466.     // Make Backspace erase the whole text
  467.     if (realChar == 0x08) {
  468.         SelectAll(ev);
  469.         fShadowTEd->SelectAll(ev);
  470.     }
  471.     
  472.     InputCharKey(ev, pwdChar); 
  473.     return fShadowTEd->InputCharKey(ev, realChar);
  474. }
  475.  
  476. //----------------------------------------------------------------------------------------
  477. // CPwdEditView::GetText
  478. //----------------------------------------------------------------------------------------
  479.  
  480. FW_CString CPwdEditView::GetText (Environment * ev)
  481. {
  482.     return fShadowTEd->GetText(ev);
  483. }
  484.  
  485.  
  486. //========================================================================================
  487. //    Archiving API with ODFRC resources
  488. //========================================================================================
  489. #if FW_ODFRC_VIEWS
  490.  
  491. //----------------------------------------------------------------------------------------
  492. //    CPwdEditView::Create
  493. //----------------------------------------------------------------------------------------
  494.  
  495. void* CPwdEditView::Create(FW_CReadableStream& stream, FW_ClassTypeConstant type)
  496. {
  497. FW_UNUSED(stream);
  498. FW_UNUSED(type);
  499.     FW_SOMEnvironment ev;
  500.     return FW_NEW(CPwdEditView, (ev));
  501. }
  502.  
  503. //----------------------------------------------------------------------------------------
  504. //    CPwdEditView::Destroy
  505. //----------------------------------------------------------------------------------------
  506.  
  507. void CPwdEditView::Destroy(void* object, FW_ClassTypeConstant type)
  508. {
  509. FW_UNUSED(type);
  510.     CPwdEditView* self = (CPwdEditView*) object;
  511.     delete self;
  512. }
  513.  
  514. //----------------------------------------------------------------------------------------
  515. //    CPwdEditView::Flatten
  516. //----------------------------------------------------------------------------------------
  517.  
  518. void CPwdEditView::Flatten(Environment* ev, FW_CWritableStream& archive) const
  519. {
  520.     FW_CEditView::Flatten(ev, archive);
  521. }
  522.  
  523. //----------------------------------------------------------------------------------------
  524. //    CPwdEditView::InitializeFromStream
  525. //----------------------------------------------------------------------------------------
  526.  
  527. void CPwdEditView::InitializeFromStream(Environment* ev, FW_CReadableStream& stream)
  528. {
  529.     FW_CEditView::InitializeFromStream(ev, stream);
  530.     
  531.     Initialize(ev, GetSuperView(ev), GetBounds(ev));
  532. }
  533.  
  534. #endif // FW_ODFRC_VIEWS
  535.  
  536. //========================================================================================
  537. //    API for reading PPob view resources
  538. //========================================================================================
  539. #if FW_PPOB_VIEWS
  540.  
  541. //----------------------------------------------------------------------------------------
  542. //    CPPobPwdEditView::CPPobPwdEditView
  543. //----------------------------------------------------------------------------------------
  544.  
  545. CPPobPwdEditView::CPPobPwdEditView(Environment*ev, FW_CReadableStream& stream, long type) :
  546.     FW_CPPobView(ev, stream)
  547. {
  548. }
  549.  
  550. //----------------------------------------------------------------------------------------
  551. //    CPPobPwdEditView::Create
  552. //----------------------------------------------------------------------------------------
  553.  
  554. void* CPPobPwdEditView::Create(Environment*ev, FW_CReadableStream& stream, long type)
  555. {
  556.     return (new CPPobPwdEditView(ev, stream, type));
  557. }
  558.  
  559. //----------------------------------------------------------------------------------------
  560. //    CPPobPwdEditView::CreateODFView
  561. //----------------------------------------------------------------------------------------
  562.  
  563. void CPPobPwdEditView::CreateODFView(Environment* ev)
  564. {
  565.     // Create CPwdEditView instance
  566.     CPwdEditView* view = FW_NEW(CPwdEditView, (ev, fSuperView, fViewID, fBounds));
  567.     view->SetBindings(ev, fBindings);
  568.     
  569.     delete this;    // we don't need you anymore...
  570. }
  571.  
  572. #endif // FW_PPOB_VIEWS
  573.  
  574. //========================================================================================
  575. //    API for reading MacApp view resources
  576. //========================================================================================
  577. #if FW_MACAPP_VIEWS
  578.  
  579. //----------------------------------------------------------------------------------------
  580. //    CMAPwdEditView::CMAPwdEditView
  581. //----------------------------------------------------------------------------------------
  582.  
  583. CMAPwdEditView::CMAPwdEditView(ResType type) :
  584.     FW_CMAEditText(type)
  585. {    
  586.     // A text-edit cannot be the content view
  587.     fIsContentView = false;
  588. }
  589.  
  590. //----------------------------------------------------------------------------------------
  591. //    CMAPwdEditView::Create
  592. //----------------------------------------------------------------------------------------
  593.  
  594. FW_CMAObject*    CMAPwdEditView::Create(ResType type)
  595. {
  596.     return new CMAPwdEditView(type);
  597. }
  598.  
  599.  
  600. //----------------------------------------------------------------------------------------
  601. //    CMAPwdEditView::CreateODFView
  602. //----------------------------------------------------------------------------------------
  603.  
  604. FW_CView*    CMAPwdEditView::CreateODFView(Environment* ev, FW_CSuperView* superview, FW_MReceiver* receiver)
  605. {
  606.     // Create CPwdEditView instance
  607.     CPwdEditView* view = FW_NEW(CPwdEditView, (ev, superview, fIdentifier, fBounds));
  608.  
  609. //    view->SetBindings(ev, fBindings);
  610.  
  611.     return view;    
  612. }
  613.  
  614. #endif // FW_MACAPP_VIEWS
  615.  
  616.